Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dot-env-json

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dot-env-json

package similar to dotenv that reads from JSON file.

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

dotenv-json

Package similar to dotenv to read from .json files. It looks for files based on NODE_ENV. Ex: .env.development.json

Usage

ES6

import dotenv from "dotenvJson";
dotenv();

CMD

node -r dotenvJson/config
# change base directory from root
node -r dotenvJson/config dotenv_config_base=config/

Configuration

Accepts an options object. Only valid option currently is base which sets the base path to look for files.

import dotenv from "dotenvJson";

# approot/config/.env.development.json
dotenv({
  base: "config/"
});

Cross Env

Since this package uses NODE_ENV it is recommended to use the cross-env package to set the environment in your run scripts.

# gets the json file approot/env.test.json
cross-env NODE_ENV=test node -r dotenvJson/config yourfile.js
# gets the json file approot/config/env.development.json
cross-env NODE_ENV=development node -r dotenvJson/config dotenv_config_base=config/ yourfile.js

Keywords

FAQs

Package last updated on 27 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc